package com.cy.demo.service.impl;

import com.cy.demo.mapper.AddressMapper;
import com.cy.demo.mapper.DistrictMapper;
import com.cy.demo.pojo.Address;
import com.cy.demo.pojo.District;
import com.cy.demo.service.IAddressService;
import com.cy.demo.service.IDistrictService;
import com.cy.demo.service.ex.AddressCountLimitException;
import com.cy.demo.service.ex.InsertException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;

@Service
public class IDistrictServiceImpl implements IDistrictService {
    @Autowired
    private DistrictMapper districtMapper;

    @Override
    public List<District> findByParent(String parent) {
        List<District> districtList = districtMapper.findByParent(parent);
        for (District district:districtList
        ) {
            System.err.println(district.toString());
        }
        return districtList;
    }

    @Override
    public String getNameByCode(String code) {


        return districtMapper.findNameByCode(code);
    }
}
